/* 
 * Copyright (c)	Insighten Intelligent Equipment co.,LTD
 * 
 *  Use of this software is controlled by the terms and conditions found
 *  in the license agreement under which this software has been supplied.
 * 
 */
/** 
 * @file udp_cli_main.c
 * @brief test for socket library
 * @author taco [tacoee@gmail.com]
 * @version 0.1
 * @date 2010-09-07
 */
#include <stdio.h>
#include <stdlib.h>

#include "rwbuf.h"
#include "sock_util.h"
#include "udp_lib.h"

void helper(char *program)
{
	fprintf(stderr, "Usage: %s remote_address[192.168.1.xxx] port[2345]\n", program);
}

int main(int argc, char *argv[])
{
	int port;
	UdpSocket *udp_cli = NULL;
	SocketAttr attr = {0,8912};
	RwBuf *buf;

	if (argc < 3) {
		helper(argv[0]);
		exit(1);
	}
	port = atoi(argv[2]);

	buf = buf_new(NULL, NULL);
	buf_init(buf, 1024);

	udp_cli = udp_socket_new();
	udp_socket_init(udp_cli, argv[1], "0.0.0.0", port, &attr);

	buf_destroy(buf);
	udp_socket_destroy(udp_cli);

	return 0;
}
